#  Name:		date-time
#  Version:		0.5
#  Part Of:		linuxrules
#  Modified:	Thu Oct 21 2010, 21:43:54

#  See COPYING for linuxrules GPL3 licensing info.

BEGIN {
    # Check for the first on 10 possible sources
    # If you want to read various sources at a time
    # drop me a line via ISSUES or mail.

    for (i = 0; i < 11; i++) {
	    rtc = "/sys/class/rtc/rtc" i "/"

        if (getline < (rtc "date") > 0)
        {
            close(rtc "date")
            break
        }
    }
    
	getline < (rtc "date")
		_datetime["DATE"] = $0

	getline < (rtc "time")
        _datetime["TIME"] = $0

    close(rtc "date")
    close(rtc "time")
}

# vim:ft=awk:
